ARD2  1.00 for Rev B. Hardware
Airbag Reference Demonstrator using MPC5604P
PIT.h File Reference

Periodic Interrupt Timer driver for MPC5604P. More...

Go to the source code of this file.

Defines

#define TRUE   (1u)
#define CLEAR   (0u)
#define BITS_IN_NIBBLE   (4u)
#define BITS_IN_BYTE   (8u)
#define BYTES_IN_16   (2u)
#define BYTES_IN_32   (4u)
#define BIT_DEFINITION
#define BIT0   (1u << 0u)
#define BIT1   (1u << 1u)
#define BIT2   (1u << 2u)
#define BIT3   (1u << 3u)
#define BIT4   (1u << 4u)
#define BIT5   (1u << 5u)
#define BIT6   (1u << 6u)
#define BIT7   (1u << 7u)
#define BIT8   (1u << 8u)
#define BIT9   (1u << 9u)
#define BIT10   (1u << 10)
#define BIT11   (1u << 11)
#define BIT12   (1u << 12)
#define BIT13   (1u << 13)
#define BIT14   (1u << 14)
#define BIT15   (1u << 15)
#define BIT16   (1u << 16)
#define BIT17   (1u << 17)
#define BIT18   (1u << 18)
#define BIT19   (1u << 19)
#define BIT20   (1u << 20)
#define BIT21   (1u << 21)
#define BIT22   (1u << 22)
#define BIT23   (1u << 23)
#define BIT24   (1u << 24)
#define BIT25   (1u << 25)
#define BIT26   (1u << 26)
#define BIT27   (1u << 27)
#define BIT28   (1u << 28)
#define BIT29   (1u << 29)
#define BIT30   (1u << 30)
#define BIT31   (1u << 31)
#define N_PIT_CHANNELS   (4u)
#define PIT_INVALID_CH   ((uint8_t)BIT0)
#define PIT_ERROR_TIMED_OUT   ((uint8_t)BIT1)
#define N_ELEMENTS(X)   (sizeof(X)/sizeof(*(X)))
#define PIT_CLEAR_FLAG(XX)   PIT.CH[XX].TFLG.R = TRUE

Functions

uint8_t u8fnPITConfig (const uint8_t u8Channel, const uint32_t u32InitialCount, const uint8_t u8UseISR)
 Configures a particular PIT channel for immediate operation.
void vfnPITStart (const uint8_t u8Channel, const uint8_t u8Enable)
 Starts or stops the timer for a particular PIT channel.
uint8_t u8fnPITWaitByPoll (const uint8_t u8Channel, const uint8_t u8Restart)
 Waits for a PIT channel to expire in RUN mode.

Detailed Description

Periodic Interrupt Timer driver for MPC5604P.

Copyright (c) 2011 Freescale Semiconductor Freescale Confidential Proprietary

Author:
Freescale Semiconductor
SASD Automotive
R11515
Version:
Date:
Warning:
(If needed)

History:


Define Documentation

#define PIT_ERROR_TIMED_OUT   ((uint8_t)BIT1)

PIT never computed the expected time error mask

#define PIT_INVALID_CH   ((uint8_t)BIT0)

Channel is not valid error mask


Function Documentation

uint8_t u8fnPITConfig ( const uint8_t  u8Channel,
const uint32_t  u32InitialCount,
const uint8_t  u8UseISR 
)

Configures a particular PIT channel for immediate operation.

Parameters:
u8Channel,:PIT channel number (0 - 3 for Pictus)
u32InitialCount,:Number of cycles to count before flagging
u8UseISR,:Switch to allow for interrupts or not
Returns:
CLEAR if all went ok; PIT_INVALID_CH if the passed channel doesn't exist in HW
uint8_t u8fnPITWaitByPoll ( const uint8_t  u8Channel,
const uint8_t  u8Restart 
)

Waits for a PIT channel to expire in RUN mode.

Parameters:
u8Channel,:PIT channel number (0 - 3 for Pictus)
u8Restart,:If non-zero, the PIT timer will be restart immediately
Returns:
Zero when PIT counted down correctly, PIT_ERROR_TIMED_OUT otherwise.
void vfnPITStart ( const uint8_t  u8Channel,
const uint8_t  u8Enable 
)

Starts or stops the timer for a particular PIT channel.

Parameters:
u8Channel,:PIT channel number (0 - 3 for Pictus)
u8Enable,:If non-zero, the timer will start, if zero it will stop
Returns:
Void.